package com.sloera.spring.beans.annotation.service;

import com.sloera.spring.beans.annotation.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @author sloera
 * @create 2020/4/6
 */
@Service
public class UserService {
    @Autowired
    public void setUserRepository(@Qualifier("userRepositoryImpl") UserRepository userRepository) {
        this.userRepository = userRepository;
    }
    //@Autowired
    //@Qualifier("userRepositoryImpl")
    //public void setUserRepository(UserRepository userRepository) {
    //    this.userRepository = userRepository;
    //}

    private UserRepository userRepository;

    public void add() {
        System.out.println("UserService add ...");
        userRepository.save();
    }
}
